/*
 * Copyright (c) 2011-2023, baomidou (jobob@qq.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package top.jiangqiang.qianyi.generator.model;

import com.baomidou.mybatisplus.generator.config.builder.CustomFile;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

/**
 * 自定义模板文件配置
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
public class EnhanceCustomFile extends CustomFile {
    /**
     * 文件名称格式化函数
     */
    private Function<TableInfo, String> formatNameFunction;

    /**
     * 文件名称
     */
    private String fileName;

    /**
     * 模板路径
     */
    private String templatePath;

    /**
     * 自定义文件包名
     */
    private String packageName;

    /**
     * 文件路径
     */
    private String filePath;

    /**
     * 是否覆盖已有文件（默认 false）
     */
    private boolean fileOverride;

    /**
     * 父类class
     */
    private Class<?> superClass;
    /**
     * 额外参数
     */
    BiConsumer<Map<String, Object>, TableInfo> extParamsFunction;
    public String getShortName() {
        return getFileName();
    }

}
